<?php

namespace App\Http\Requests\Backend\Setting;

use Illuminate\Foundation\Http\FormRequest;

class SourceStoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'source_id'=>'required|unique:setting_sources',
            'source_name'=>'required|unique:setting_sources',
            'ios_path'=>'required',
            'android_path'=>'required',
            'type'=>'required',
            'old'=>'',
            'web_path'=>'',
        ];
    }

    public function messages()
    {
        return [
            'source_id.required'=>'渠道id必填',
            'source_name.required'=>'渠道名称必填',
            'ios_path.required'=>'ios路径必填',
            'android_path.required'=>'android路径必填',
            'type.required'=>'类型必填',
            'source_id.unique'=>'渠道号已存在',
            'source_name.unique'=>'渠道名称已存在',
        ];
    }
}
